#include <cassert>
#include <fstream>

#include "ResourceType.h"
#include "../tools/Log.h"
#include "Game.h"

using namespace std;

ResourceType::ResourceType(int id, string name) : name(name), id(id) { }

void ResourceType::load_from_file(Game *, string file_name)
{
	char line[255];
	ifstream fin(file_name.c_str());
	
	if (!fin) {
		lout << "WARNING: ResourceType - Unable to load resource type config file: \"" << file_name << "\"" << endl;	
		return;
	}
	
	while (fin.getline(line, 255))
	{
		if (line[0] == '#') continue; 
		
		unsigned id;
		char name[255];
		sscanf(line, "%u %s", &id, name);
		
	//	game->add_resource_type(new ResourceType(id, name));
	}
	
	fin.close();
}
